﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using LibFriesland_Campina_CRM;
using System.Data;

namespace WebServiceFriesland_Campina_CRM
{
    /// <summary>
    /// Summary description for FCAttendanceTrackingWS
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class FCAttendanceTrackingWS : System.Web.Services.WebService
    {
        [WebMethod]
        //Them theo doi cham cong cua mot NA
        public int addAttendanceTracking(string pDatetime_phone, string pDatetime_gps, double pLongitude, double pLatitude, string pBy_na, string pBy_shift, string pBy_time_point, string pBy_shop)
        {
            BizAttendanceTracking attendanceTracking = new BizAttendanceTracking(-1, pDatetime_phone, Thuvien.myConvertDatetimeToString(DateTime.Now), pDatetime_gps, pLatitude, pLongitude, pBy_na, pBy_shift, pBy_time_point);
            attendanceTracking.by_shop = pBy_shop;
            return attendanceTracking.addAttendanceTracking();
        }

        [WebMethod]
        //Lay thong tin cham cong cua NA theo ngay
        public List<BizAttendanceTracking> getAttendanceTrackingbyNA(string pNa_charid, string pDatetime_system,  string pShop_charid, string pShift_charid)
        {
            return BizAttendanceTracking.getAttendanceTrackingbyNA(pNa_charid, Convert.ToDateTime(Thuvien.myConvertStringToShortDate(pDatetime_system)), pShop_charid, pShift_charid);
        }

        [WebMethod]
        //Cap nhat thong tin theo doi cham cong cua Supervisor
        public int updateAttendanceTrackingbySup(int pAttendance_tracking_numid, string pAction_monitoring, string pComment_monitoring)
        {
            return BizAttendanceTracking.updateAttendanceTracking(pAttendance_tracking_numid, DateTime.Now, pAction_monitoring, pComment_monitoring);
        }
    }
}
